<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <video src="" id="video" autoplay playsinline muted></video>
    </div>

    <script>
        // 获取本地音视频流
        async function getLocalStream(constraints) {
            // 获取媒体流
            const stream = await navigator.mediaDevices.getUserMedia(constraints)
            const video = document.querySelector('#video');
            video.srcObject = stream
            console.log(stream)
        }

        getLocalStream({
            audio: false,
            video: true,
        });

    </script>
</body>

</html>